// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   BAG_TELImpl.java

package com.sunwayhorizo.health.hl7.datatypes.common;

import com.sunwayhorizo.health.hl7.common.VersionInfo;
import com.sunwayhorizo.health.hl7.datatypes.ANY;
import com.sunwayhorizo.health.hl7.datatypes.BAG_TEL;
import com.sunwayhorizo.health.hl7.datatypes.BL;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.datatypes.INT;
import com.sunwayhorizo.health.hl7.datatypes.TEL;
import com.sunwayhorizo.health.hl7.datatypes.TYPE;

import java.util.List;

// Referenced classes of package oracle.apps.ctb.hl7.types.common:
//            BAGCommonImpl, ANYImpl, CSImpl, NullFlavorImpl, 
//            TYPEImpl

public class BAG_TELImpl extends BAGCommonImpl implements BAG_TEL {

	public static final String RCS_ID = "$Header: BAG_TELImpl.java 115.23 2005/09/16 09:24:01 amchanda noship $";
	public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion(
					"$Header: BAG_TELImpl.java 115.23 2005/09/16 09:24:01 amchanda noship $",
					"oracle.apps.ctb.hl7.types.common");
	private static final BAG_TEL nullNI = new BAG_TELImpl(CSImpl.valueOf("NI"));
	private static final BAG_TEL nullOTH = new BAG_TELImpl(
			CSImpl.valueOf("OTH"));
	private static final BAG_TEL nullNINF = new BAG_TELImpl(
			CSImpl.valueOf("NINF"));
	private static final BAG_TEL nullPINF = new BAG_TELImpl(
			CSImpl.valueOf("PINF"));
	private static final BAG_TEL nullUNK = new BAG_TELImpl(
			CSImpl.valueOf("UNK"));
	private static final BAG_TEL nullASKU = new BAG_TELImpl(
			CSImpl.valueOf("ASKU"));
	private static final BAG_TEL nullNAV = new BAG_TELImpl(
			CSImpl.valueOf("NAV"));
	private static final BAG_TEL nullMSK = new BAG_TELImpl(
			CSImpl.valueOf("MSK"));
	private static final BAG_TEL nullNA = new BAG_TELImpl(CSImpl.valueOf("NA"));
	private static final BAG_TEL nullNASK = new BAG_TELImpl(
			CSImpl.valueOf("NASK"));

	public static BAG_TEL valueOf(TEL atel[]) {
		return new BAG_TELImpl(atel);
	}

	public static BAG_TEL valueOf(TEL tel) {
		return new BAG_TELImpl(tel);
	}

	public static BAG_TEL valueOf(List list) {
		if (list == null)
			throw ANYImpl.newNullException("BAG<TEL>", "valueOf", "list");
		else
			return new BAG_TELImpl(list);
	}

	protected BAG_TELImpl(TEL atel[]) {
		if (atel == null)
			throw ANYImpl.newNullException("BAG<TEL>", "constructor",
					"elements");
		for (int i = 0; i < atel.length; i++)
			if (atel[i] != null && atel[i].isNull().isFalse())
				mList.add(atel[i]);

	}

	protected BAG_TELImpl(TEL tel) {
		if (tel == null || tel.isNull().isTrue()) {
			throw ANYImpl
					.newNullException("BAG<TEL>", "constructor", "element");
		} else {
			mList.add(tel);
			return;
		}
	}

	protected BAG_TELImpl(List list) {
		super(list);
	}

	protected BAG_TELImpl(CS cs) {
		super(cs);
	}

	public INT contains(TEL tel) {
		return containsANY(tel);
	}

	public BAG_TEL plus(BAG_TEL bag_tel) {
		if (isNull().isTrue())
			return nullBAG_TEL(NullFlavorImpl.NI);
		else
			return new BAG_TELImpl(plus(mList, bag_tel.toList()));
	}

	public BAG_TEL minus(BAG_TEL bag_tel) {
		if (isNull().isTrue())
			return nullBAG_TEL(NullFlavorImpl.NI);
		else
			return new BAG_TELImpl(minus(mList, bag_tel.toList()));
	}

	public BAG_TEL promotion(TEL tel) {
		return new BAG_TELImpl(promoteItem(tel));
	}

	public TYPE dataType() {
		return com.sunwayhorizo.health.hl7.datatypes.common.TYPEImpl.BAG_TEL;
	}

	public BL equal(ANY any) {
		throw ANYImpl.newUnsupportedException("BAG<TEL>", "equal");
	}

	public int hashCode() {
		int i = 17;
		if (isNull().isFalse())
			i += mList.hashCode();
		return i;
	}

	protected boolean verifyItem(Object obj) {
		return obj instanceof TEL;
	}

	public static BAG_TEL nullBAG_TEL(CS cs) {
		String s = null;
		if (cs == null || cs.literal().stringValue() == null
				|| cs.isNull().isTrue())
			s = "NI";
		else
			s = cs.literal().stringValue();
		if (s.equals("NI"))
			return nullNI;
		if (s.equals("OTH"))
			return nullOTH;
		if (s.equals("NINF"))
			return nullNINF;
		if (s.equals("PINF"))
			return nullPINF;
		if (s.equals("UNK"))
			return nullUNK;
		if (s.equals("ASKU"))
			return nullASKU;
		if (s.equals("NAV"))
			return nullNAV;
		if (s.equals("MSK"))
			return nullMSK;
		if (s.equals("NA"))
			return nullNA;
		if (s.equals("NASK"))
			return nullNASK;
		else
			return nullNI;
	}

}
